<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>侦听器</title>
</head>
<body>
<div id="app">
  <span>{{msg}}</span>
  br
  <button @click="msg='你好'">改变内容</button>
</div>
</body>
<script src="../js/vue.js"></script>
<script !src="">
  var vm = new Vue({
    el: '#app',
    data: {
      msg: "hello"
    },
    watch: {
      msg: function (val, oldVal) {
        console.log('new: %s, old: %s', val, oldVal)
      }
    }
  });
</script>
</html>